/*
 * Class: CustomerController
 * Created by: Mary Joy Pascual
 * Date Created: 06/16/2014
 * Company: Netsuite
*/
package com.netsuite.controller;

import java.util.List;

import com.netsuite.dao.CustomerDAO;
import com.netsuite.helper.ErrorHelper;
import com.netsuite.logger.LoggerImp;
import com.netsuite.pojo.CustomerPOJO;

public class CustomerController {

	private static String CLASS_NAME = CustomerController.class.getName();
	
	private CustomerDAO customerDAO = null;
	
	public CustomerController() throws ErrorHelper{
		customerDAO = new CustomerDAO();
	}
	
	public List<CustomerPOJO> getCustomerList() throws ErrorHelper  {
		return customerDAO.getCustomerList();
	}
	
	public CustomerPOJO getCustomer(String internalId, String externalId) throws ErrorHelper {
		return customerDAO.getCustomer(internalId, null);
	}
	
	public String addCustomer(CustomerPOJO customerPOJO) throws ErrorHelper {
		return customerDAO.addCustomer(customerPOJO);
	}
	
	public void updateCustomer(CustomerPOJO cus) throws ErrorHelper {
		
		LoggerImp.startLog(CLASS_NAME, "updateCustomer()");
		customerDAO.updateCustomer(cus);
		LoggerImp.endLog(CLASS_NAME, "updateCustomer()");
		
	}
	
	public void deleteCustomer(String internalId, String externalId) throws ErrorHelper  {
		
		LoggerImp.startLog(CLASS_NAME, "deleteCustomer()");
		customerDAO.deleteCustomer(internalId, null);
		LoggerImp.endLog(CLASS_NAME, "deleteCustomer()");
		
	}
	
	public List<CustomerPOJO> searchCustomer(String id, String criteria) throws ErrorHelper {
		return customerDAO.searchCustomer(id, criteria);
	}
	
	
}
